Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MAT-7471: Disable auto-encoding on FhirTerminologyServiceWebClient #97

Merged
merged 1 commit into from
Jul 16, 2024

Conversation

jkotanchik-SB
Copy link
Contributor

@jkotanchik-SB jkotanchik-SB commented Jul 16, 2024

Terminology Service PR

Jira Ticket: MAT-7471
(Optional) Related Tickets:

Summary

Manually control when uri data is html encoded by disabling auto-encoding on FhirTerminologyServiceWebClient.

Our config of the FhirTerminologyServiceWebClient auto-encodes String uri values by way of setting the WebClient.Builder baseUrl(). Effectively, doing so serves as a shortcut to use the default UriBuilderFactory, which is configured to encode uri Strings by default.

When a URI object is passed to the WebClient request chain, the UriBuilderFactory is not used. Instead, the WebClient uses the supplied URI as is. Which also means it does not use the baseUrl set on the WebClient since the baseUrl is passed down to the default UriBuilderFactory instance that gets bypassed when making a request with a URI object.

See: https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/web/reactive/function/client/WebClient.Builder.html#baseUrl(java.lang.String)

See: https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/web/util/DefaultUriBuilderFactory.html#setEncodingMode(org.springframework.web.util.DefaultUriBuilderFactory.EncodingMode)

All Submissions

  • This PR has the JIRA linked.
  • Required tests are included.
  • No extemporaneous files are included (i.e Complied files or testing results).
  • This PR is merging into the correct branch.
  • All Documentation needed for this PR is Complete (or noted in a TODO or other Ticket).
  • Any breaking changes or failing automations are noted by placing a comment on this PR.

DevSecOps

If there is a question if this PR has a security or infrastructure impact, please contact the Security or DevOps engineer assigned to this project to discuss it further.

  • This PR has NO significant security impact (i.e Changing auth methods, Adding a new user type, Adding a required but vulnerable package).

Reviewers

By Approving this PR you are attesting to the following:

  • Code is maintainable and reusable, reuses existing code and infrastructure where appropriate, and accomplishes the task’s purpose.
  • The tests appropriately test the new code, including edge cases.
  • If you have any concerns they are brought up either to the developer assigned, security engineer, or leads.

@jkotanchik-SB jkotanchik-SB requested a review from a team as a code owner July 16, 2024 16:43
@jkotanchik-SB jkotanchik-SB self-assigned this Jul 16, 2024
@jkotanchik-SB jkotanchik-SB changed the title MAT-7471: For requests to FHIR Term Service, pass URI's as objects instead of Strings so that we can manually apply html encoding when desired. MAT-7471: Pass URI's as objects instead of Strings Jul 16, 2024
… a custom UriBuilderFactory.

Our config of the `FhirTerminologyServiceWebClient` enabled auto-encoding of String uri values by setting the `WebClient.Builder baseUrl()`. Effectively a shortcut to use the default `UriBuilderFactory`, which encodes uri Strings by default.

When a URI object is passed to the WebClient request chain, the `UriBuilderFactory` is not used. Instead, the WebClient uses the supplied URI as is, which also means it doesn't use baseUrl configured on the WebClient builder as the underlying UriBuilderFactory is also not used.

See: https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/web/reactive/function/client/WebClient.Builder.html#baseUrl(java.lang.String)

See: https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/web/util/DefaultUriBuilderFactory.html#setEncodingMode(org.springframework.web.util.DefaultUriBuilderFactory.EncodingMode)
@jkotanchik-SB jkotanchik-SB force-pushed the feature/mat-7471-manual-hmtl-encoding branch from 7ab8bdb to 9fee360 Compare July 16, 2024 17:18
@jkotanchik-SB jkotanchik-SB changed the title MAT-7471: Pass URI's as objects instead of Strings MAT-7471: Disable auto-encoding on FhirTerminologyServiceWebClient Jul 16, 2024
@jkotanchik-SB jkotanchik-SB merged commit 1e4cc01 into develop Jul 16, 2024
6 checks passed
@jkotanchik-SB jkotanchik-SB deleted the feature/mat-7471-manual-hmtl-encoding branch July 16, 2024 17:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants